package com.bqy.myokgo.fragment.pager;

import android.support.v4.app.Fragment;
import android.support.v4.view.ViewPager;
import android.view.View;

import com.bqy.myokgo.R;
import com.bqy.myokgo.base.MyBaseActivity;
import com.bqy.myokgo.utils.SimpleFragmentAdapter;

import java.util.ArrayList;
import java.util.List;

/**
 * 熊猫先生
 * 2019/1/29:11:43
 */

public class FragmentActivity extends MyBaseActivity {

    FragmentOne fragmentOne;
    FragmentTwo fragmentTwo;
    FragmentThree fragmentThree;
    List<Fragment> fragmentList = new ArrayList<>();
    SimpleFragmentAdapter adapter;
    ViewPager viewPager;

    @Override
    public View setContentView() {
        return View.inflate(this, R.layout.activity_fragment, null);
    }

    @Override
    public void iniView() {
        viewPager = findViewById(R.id.vp);
        fragmentList.add(fragmentOne = new FragmentOne());
        fragmentList.add(fragmentTwo = new FragmentTwo());
        fragmentList.add(fragmentThree = new FragmentThree());
        adapter = new SimpleFragmentAdapter(getSupportFragmentManager(),fragmentList);
        viewPager.setAdapter(adapter);
    }

}
